﻿@model KRM.Core.VoucherDefault
@{
    ViewBag.Title = "Add Voucher";
    Layout = "/Views/Shared/_PopupLayout.cshtml";
}
<div class="popup padding10">
<form action="/Voucher/AddVoucher" class="row-fluid form-horizontal nomargin  " method="POST" id = "frAddVoucher">
    @Html.Partial("/Views/Voucher/_DefineVoucherCoverage.cshtml")
    <div class="row-fluid">
        <label for="textfield" class="span1 bottom">Reason</label>
        <div class="span4">
            @Html.DropDownList("VoucherReasonID", null, new {required = "required", onchange="loadvoucherdefault(this.value)"})
        </div>
        <div class="span3">
            <a href="/Voucher/AddVoucherReason" class="btn btn-primary" >New Reason</a>
        </div>
    </div>
    <fieldset> 
        <legend>Voucher Details</legend>
        <div id="AddVoucher" >
            <div id="Msg-Result" class="row-fluid"></div>
            <div id="body-frVoucherDetail">
                @if(@Model !=null)
                {
                    <div class="row-fluid">
                        <div class="span6">
                            <div class="control-group">
                                <label for="textfield" class="control-label">Voucher Code</label>
                                <div class="controls">
                                    @if (ViewBag.IsManualVoucerCode)
                                    {
                                        <input type="text" name="VoucherCode" required="required"class="input-block-level"/>
                                    }
                                    else
                                    {
                                        <input type="hidden" name="VoucherCode" value="@ViewBag.VoucherCode"/>
                                        <h4 style="color: #0C31C4;" >@ViewBag.VoucherCode</h4>
                                    }
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="textfield" class="control-label">ValueType</label>
                                <div class="controls">
                                    @if(ViewBag.VoucherReasonID1==26)
                                    {
                                        @Html.DropDownList("VoucherValueTypeID", null, new {required = "required", disabled="disabled",style="width: 100%"});
                                    }
                                    else
                                    {
                                        @Html.DropDownList("VoucherValueTypeID", null, new {required = "required" ,style="width: 100%"});
                                    }
                                </div>
                            </div>
                            <div class="control-group">
                                
                                <label for="textfield" class="control-label">Value</label>
                                <div class="controls">
                                    <input type="text"  name="Value"  id="Value" required="required" data-rule-number="true" class="input-block-level"value="@Model.Value" >                                </div>
                            </div>

                            <div class="control-group">
                                <label for="textfield" class="control-label">Minimum Spend</label>
                                <div class="controls">
                                    <input type="text"  name="MinimumSpendValue"  id="MinimumSpendValue" required="required" data-rule-number="true" value="@Model.MinimumSpendValue"class="input-block-level">                                </div>
                            </div>

                            <div class="control-group">
                                <label for="textfield" class="control-label">Voucher Type</label>
                                <div class="controls">
                                    @Html.DropDownList("VoucherTypeID", null, new {required = "required",style="width: 100%"})                            
                                </div>
                            </div>

                            <div class="control-group">
                                <label for="textfield" class="control-label">Expiry Date</label>
                                <div class="controls">
                                    <div id="datetimepicker2" class="input-append"style="width: 100%" >
                                        <input data-format="MM/dd/yyyy" type="text" style="width: 81%" name="ExpiryDate" id="ExpiryDate" value="@DateTime.Now.AddDays(Model.ExpiryDays).ToString("MM/dd/yyyy")" required="required">
                                        <span class="add-on">
                                            <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                                        </span>
                                    </div>
                                </div>  
                            </div>
                            <div class="control-group">
                                <label for="textfield" class="control-label">Valid From Date</label>
                                <div class="controls">
                                    <div id="datetimepicker3" class="input-append"style="width: 100%" >
                                        <input data-format="MM/dd/yyyy" type="text" style="width: 81%" name="ValidFromDate" id="ValidFromDate" value="@DateTime.Now.ToString("MM/dd/yyyy")" required="required">
                                        <span class="add-on">
                                            <i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i>
                                        </span>
                                    </div>
                                </div>
                            </div>

                            <div class="control-group">
                                <label for="textfield" class="control-label">Redemption Method</label>
                                <div class="controls">
                                    @Html.DropDownList("RedemptionMethodID", null, new {required = "required",style="width: 100%"})
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="textfield" class="control-label">Groupon Order Value</label>
                                <div class="controls">
                                    <input type="text" id="GrouponOrderValue" name="GrouponOrderValue"class="input-block-level">
                                </div>
                            </div>

                            <div class="control-group">
                                <div class="controls">
                                    <label class="checkbox">
                                        <input type="checkbox" name="IsUseForOnce"  value="true">  Use for once
                                    </label>
                                </div>
                            </div>
                        </div> 
                        <div class="span6">
                            <div class="control-group">
                                <label for="textfield" class="">Description</label>
                                <div class="">
                                    <textarea name="VoucherDescription" id="VoucherDescription"class="input-block-level" rows="9" required = "required">@Model.Description</textarea>
                                </div>
                            </div>
                            
                            <div class="control-group">
                                <label for="textfield" class="control-label">Campaign</label>
                                <div class="controls">
                                    @Html.DropDownList("CampaignID", null, new {style="width: 100%"})
                                </div>
                            </div>
                            <div class="control-group">
                                <label for="textfield" class="control-label">Layout</label>
                                <div class="controls">
                                    @Html.DropDownList("VoucherLayoutID", null, new {style="width: 100%"})
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row-fluid">
                        <div class="span7 text-center">
                            <button type="submit" class="btn btn-primary" >Create Voucher</button>
                            <button type="reset" class="btn ">Clear</button>
                        </div>
                        <div class="span3 text-right">
                            <a href="#frDefineVoucherCoverage"  role="button" data-toggle="modal"  class="btn btn-primary" >Define Voucher Coverage</a> 
                        </div>
                    </div>

                }
                
            </div>
        </div>
    </fieldset>
</form>
</div>